import React, { useEffect } from 'react'
import {useSelector,useDispatch} from "react-redux"
import {asyncGetLol} from "../../store/slices/LolSlice"
import "./Lol.css"
export default function Lol() {

    let dispatch = useDispatch();

    //获取store  lol 数据
    let {lol}= useSelector(state => state);

    useEffect(()=>{
        dispatch(asyncGetLol());
    },[])

    return (
       
            <ul className='lol'>
                {
                    lol.value.map(item => {
                        return <li key={item.id}>
                                    <img src={item.avatar} alt="" />
                                    <h3>{item.name}</h3>
                                </li>
                    })
                }
                


            </ul>
       
    )
}
